from django.db import models

# Create your models here.
from users.models import User


class OperatorLog(models.Model):
    """操作日志"""
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='用户')
    action_time = models.DateTimeField(auto_now_add=True, verbose_name="操作时间")
    message = models.CharField(max_length=200, verbose_name='操作记录')

    class Meta:
        db_table = 'tb_operatorlog'
        verbose_name = "操作日志"
        verbose_name_plural = verbose_name
        ordering = ['id']

    def __str__(self):
        return self.user.username
